:root {
    --primary-color: #f14308;
    --secondary-color: #00ccff;
    --dark-bg: #0a1929;
    --card-bg: #0f2942;
    --text-color: #e0f0ff;
    --accent-color: #00ffcc;
    --danger-color: #ff3366;
    --warning-color: #ffcc00;
    --success-color: #33cc33;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/beijing.jpg'); /* 假设图片在 static/images 目录下 */
    background-size: cover;
    background-position: center;
    filter: brightness(0.7);
    z-index: -1;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--dark-bg); /* Fallback if image doesn't load */
    color: var(--text-color);
    overflow: hidden; /* Prevents scrollbars from the main body */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.dashboard-container {
    width: 90%;
    max-width: 1800px; /* Max width for very large screens */
    perspective: 2000px; /* For 3D effect */
}

.dashboard {
    width: 100%;
    height: 80vh; /* Adjust overall dashboard height */
    display: flex;
    transform-style: preserve-3d;
    position: relative;
}

.panel {
    background-color: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.5);
    height: 100%;
    position: relative; /* For absolute positioning of children if needed */
    overflow: hidden; /* Important for content scroll and border-radius */
}

.panel-left {
    width: 25%;
    transform: rotateY(45deg) translateZ(-150px);
    z-index: 1;
}

.panel-center {
    width: 50%;
    transform: translateZ(0);
    z-index: 3; /* Center panel on top */
}

.panel-right {
    width: 25%;
    transform: rotateY(-45deg) translateZ(-150px);
    z-index: 1;
}

.panel-content {
    padding: 20px; /* Unified padding */
    height: 100%;
    overflow-y: auto; /* Enable scrolling within panels */
}
/* Custom scrollbar for panel content */
.panel-content::-webkit-scrollbar {
    width: 8px;
}
.panel-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}
.panel-content::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 10px;
    border: 2px solid var(--card-bg);
}


.panel-title {
    font-size: 18px; /* Slightly smaller title */
    margin-bottom: 15px;
    color: var(--accent-color);
    border-bottom: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.3); /* Use secondary for border */
    padding-bottom: 10px;
    display: flex; /* Align icon and text */
    align-items: center;
}
.panel-title i {
    margin-right: 10px; /* Space between icon and text */
}

/* Card styling (generic, used in multiple panels) */
.card {
    background-color: rgba(77, 171, 255, 0.05); /* More subtle background */
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.15);
}

.card-header { /* Used in Search card in HTML */
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 16px;
    color: var(--accent-color);
}
.card-header i {
    margin-right: 8px;
}

.card-content {
    font-size: 14px;
}
.card-content p {
    margin-bottom: 8px;
    line-height: 1.5;
}
.card-content p:last-child {
    margin-bottom: 0;
}

/* Left Panel Specifics (System Info, Stats, Settings, Cases) */
.panel-left .card .panel-title { /* Override general panel-title for cards in left panel if needed */
    font-size: 16px;
    margin-bottom: 10px;
}

/* Risk Cases in Left Panel */
.case-card {
    background-color: rgba(var(--secondary-color-rgb, 0, 204, 255), 0.05);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid var(--secondary-color);
}
.case-card:last-child {
    margin-bottom: 0;
}
.case-title { /* This was previously defined, let's refine */
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--text-color); /* More readable title */
    font-size: 14px;
}
.case-description { /* Renamed from case-desc for consistency */
    font-size: 12px;
    color: #a3c3ff; /* Existing color */
    margin-bottom: 8px;
    line-height: 1.4;
}
.case-link {
    display: inline-block;
    font-size: 12px;
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}
.case-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}


/* Center Panel Specifics */
.dashboard-header {
    text-align: center;
    margin-bottom: 15px;
}
.dashboard-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 5px;
}
.dashboard-subtitle {
    font-size: 14px;
    color: var(--accent-color);
}

.world-map { /* Container for the AMap */
    width: 100%;
    height: 350px; /* Adjust height as needed, or use percentage */
    /* height: 45%; Example if panel-content has defined height blocks */
    background-color: #0d2f6a; /* Fallback, AMap will cover this */
    border-radius: 10px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden; /* Important for AMap tiles and rounded corners */
    border: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.2);
}
#map { /* The actual AMap div */
    width: 100%;
    height: 100%;
}


.dashboard-controls {
    background-color: rgba(77, 171, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    /* height: 35%; Remove fixed height, let content define it or use flex-grow */
    display: grid; /* Use grid for better control */
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 10px; /* Gap between items */
    margin-bottom: 15px;
}

/* Removed .control-row as dashboard-controls is now a grid */
.control-item {
    background-color: rgba(0, 123, 255, 0.15);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.control-title {
    font-size: 12px;
    color: #a3c3ff;
    margin-bottom: 5px;
}

.control-value {
    font-size: 16px; /* Adjusted for space */
    font-weight: bold;
    color: var(--accent-color);
}

/* Form elements styling (generic for inputs, selects) */
.form-group {
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--accent-color);
}
.form-group label i {
    margin-right: 5px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 8px 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(var(--primary-color-rgb, 241, 67, 8), 0.7);
    border-radius: 5px;
    color: var(--text-color);
    font-size: 14px;
}
.form-group input::placeholder {
    color: rgba(224, 240, 255, 0.5);
}

.btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
    margin-top: 10px; /* Spacing if it's after form groups */
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn i {
    margin-right: 8px;
}
.btn:hover {
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.5);
    transform: translateY(-2px);
}
.btn:disabled {
    background: gray;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Stats Container (3 cards in a row) */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Responsive columns */
    gap: 15px;
    margin-bottom: 15px;
}
.stat-card {
    background-color: rgba(var(--card-bg-rgb, 15, 41, 66), 0.8); /* Match panel bg but slightly different alpha */
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.15);
}
.stat-card .stat-label:first-child { /* Main label */
    color: var(--text-color);
    font-size: 13px;
    margin-bottom: 5px;
}
.stat-card .stat-value {
    font-size: 22px; /* Adjusted */
    font-weight: bold;
    color: var(--accent-color);
    margin: 5px 0;
}
.stat-card .stat-label:last-child { /* Sub-label like '较昨日' */
    color: #a3c3ff;
    font-size: 11px;
}

/* Two Column Form */
.two-column-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Responsive columns */
    gap: 15px;
}

/* Risk Analysis Section (Score, Level, Radar Chart) */
.risk-score {
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    margin: 15px 0 5px 0; /* Adjusted margin */
}
.risk-level {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin: 0 auto 15px auto; /* Center the inline-block */
    padding: 6px 12px;
    border-radius: 5px;
    display: inline-block; /* Allows centering with margin auto */
    color: white; /* Text color for all levels */
}
.level-high { background-color: var(--danger-color); }
.level-medium { background-color: var(--warning-color); }
.level-low { background-color: var(--success-color); }

/* Specific ECharts container for Radar Chart */
#radarChart.chart-container { /* ID has more specificity */
    width: 100%;
    min-height: 280px; /* Adjusted height for radar */
    margin-bottom: 15px; /* Space after radar chart */
}

/* Risk Factors and Suggestions */
#riskFactors p, #suggestions p { /* General paragraphs in these sections */
    line-height: 1.6;
    margin-bottom: 8px;
}
#riskFactors .error-message, #suggestions .error-message {
    color: var(--danger-color);
    font-weight: bold;
}
/* Suggestions list styling */
.suggestion-item { /* Assuming JS will wrap suggestions in this class if not already */
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}
.suggestion-item:before {
    content: "•"; /* Bullet point */
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-size: 16px;
    line-height: 1; /* Align bullet better */
}


/* Right Panel Specifics */
/* Pie chart container */
.pie-chart {
    width: 100%;
    min-height: 250px; /* Ensure enough height for pie chart */
    margin-bottom: 15px;
}
#riskDistributionChart {
    max-height: 250px; /* To prevent it from growing too large if container allows */
}

/* Table for "最近评估" */
.table-container { /* Add a wrapper if needed for scrolling fixed header table */
    overflow-x: auto; /* For very narrow screens if table content is wide */
}
table.table { /* More specific selector for the table */
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px; /* Space from title */
}
table.table th, table.table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.2);
    font-size: 13px; /* Slightly larger for readability */
}
table.table th {
    color: var(--accent-color);
    font-weight: 600;
}
table.table td {
    color: var(--text-color);
}
table.table tr:last-child td {
    border-bottom: none; /* Remove border from last row */
}
table.table td span[style*="color"] { /* For risk level text in table */
    font-weight: bold;
}


/* ------ ADDITIONS/MODIFICATIONS FOR AMAP (高德地图) ------ */

/* Custom AMap Marker Styles */
.custom-amap-marker {
    position: relative;
    width: 30px;  /* Match dimensions from JS for offset calculations */
    height: 42px; /* Match dimensions from JS for offset calculations */
}

.marker-pin-amap {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0; /* Teardrop top */
    transform: rotate(-45deg);
    position: absolute;
    left: 0px;
    top: 0px;
    border: 2px solid var(--text-color); /* Use theme color for border */
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); /* Darker shadow for better contrast on map */
    /* background-color is set dynamically in JS based on risk */
}

.marker-icon-amap {
    position: absolute;
    top: 7px;
    left: 7px;
    font-size: 16px;
    color: var(--text-color); /* Theme color for icon */
    transform: rotate(45deg); /* Counter-rotate if the pin is rotated */
    text-shadow: 0 0 3px rgba(0,0,0,0.7); /* Slight shadow for readability */
}

/* AMap InfoWindow Styling */
.amap-info-contentContainer, .amap-info-content { /* Targeting AMap's generated container */
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5) !important;
    border: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.3) !important;
}

.amap-info-close { /* Close button for InfoWindow */
    color: var(--text-color) !important;
    right: 12px !important; /* Adjust position */
    top: 12px !important;
    font-size: 18px !important; /* Make it slightly larger */
}
.amap-info-close:hover {
    color: var(--accent-color) !important;
}

/* Styles for the content *inside* our .amap-info-window div (created in JS) */
.amap-info-window {
    font-family: 'Segoe UI', Arial, sans-serif;
    padding: 8px 12px; /* Internal padding for our content */
    min-width: 230px;
}
.amap-info-window h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-color);
    border-bottom: 1px solid rgba(241, 67, 8, 0.4); /* --primary-color with alpha */
    padding-bottom: 6px;
}
.amap-info-window p {
    margin: 5px 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-color);
}
.amap-info-window p span[style*="color"] { /* For the risk level text */
    font-weight: bold;
}

/* AMap attribution, logo - make them less obtrusive or themed */
.amap-logo {
    opacity: 0.6 !important;
    filter: grayscale(60%) brightness(1.3) !important;
    transition: opacity 0.3s ease;
}
.amap-logo:hover {
    opacity: 0.9 !important;
}
.amap-copyright {
    color: rgba(224, 240, 255, 0.5) !important;
    background: rgba(15, 41, 66, 0.6) !important; /* var(--card-bg) with alpha */
    padding: 2px 5px !important;
    border-radius: 3px !important;
    font-size: 10px !important;
}

/* AMap Toolbar Controls - Theme them to match */
.amap-toolbar {
    background-color: rgba(15, 41, 66, 0.75) !important; /* var(--card-bg) with alpha */
    border: 1px solid rgba(0, 204, 255, 0.25) !important; /* var(--accent-color) with alpha */
    border-radius: 5px !important;
}

.amap-toolbar light, .amap-toolbar dark { /* Internal AMap styles if they exist for themes */
    background-color: transparent !important;
}

.amap-toolbar .amap-btn,
.amap-toolbar .amap-btn:hover,
.amap-toolbar .amap-btn:active {
    background-color: rgba(0, 123, 255, 0.25) !important; /* From .control-item, bit more subtle */
    color: var(--text-color) !important;
    border-bottom: none !important;
    box-shadow: none !important;
    transition: background-color 0.2s ease;
}
.amap-toolbar .amap-btn:hover {
    background-color: rgba(0, 123, 255, 0.45) !important;
}

.amap-toolbar .amap-zoom-cursor {
    background-color: rgba(0, 123, 255, 0.15) !important;
    color: var(--text-color) !important;
}

/* AMap Scale Control */
.amap-scalecontrol {
    bottom: 25px !important; /* Adjust if overlapping with copyright */
    left: 10px !important;
}
.amap-scale-text {
    color: var(--text-color) !important;
    text-shadow: 1px 1px 2px #0a1929; /* var(--dark-bg) for shadow */
}
.amap-scale-line {
    background-color: var(--text-color) !important;
    box-shadow: 1px 1px 2px #0a1929; /* var(--dark-bg) for shadow */
}

/* AMap MapType Control (if used) */
.amap-maptypecontrol {
    background-color: rgba(15, 41, 66, 0.75) !important; /* var(--card-bg) with alpha */
    border: 1px solid rgba(0, 204, 255, 0.25) !important;
    border-radius: 5px !important;
}
.amap-maptypecontrol .amap-maptype-item,
.amap-maptypecontrol .amap-maptype-item-selected {
    color: var(--text-color) !important;
    transition: background-color 0.2s ease;
}
.amap-maptypecontrol .amap-maptype-item:hover {
    background-color: rgba(0, 123, 255, 0.3) !important;
}
.amap-maptypecontrol .amap-maptype-item-selected,
.amap-maptypecontrol .amap-maptype-item-selected:hover {
    background-color: rgba(0, 123, 255, 0.5) !important;
}

/* AMap HawkEye (Minimap) */
.amap-hawkeye {
    border: 1px solid rgba(0, 204, 255, 0.25) !important;
    background-color: rgba(10, 25, 41, 0.7) !important; /* var(--dark-bg) with alpha */
}
.amap-hawkeye-ops { /* The open/close button for hawkeye */
    background-color: rgba(15, 41, 66, 0.8) !important; /* var(--card-bg) with alpha */
    color: var(--text-color) !important;
}
/* ------ END OF AMAP ADDITIONS ------ */


/* Animation for elements appearing */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Apply fadeIn to cards for a subtle effect */
.card, .stat-card {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0; /* Start transparent for animation */
    animation-delay: calc(var(--card-index, 0) * 0.1s); /* Stagger animation if you set --card-index in JS */
}


/* Responsive Design Adjustments */
@media (max-width: 1400px) {
    .dashboard {
        height: 85vh;
    }
    .panel-left, .panel-right {
        width: 22%;
        transform: rotateY(40deg) translateZ(-120px);
    }
    .panel-right {
        transform: rotateY(-40deg) translateZ(-120px);
    }
    .panel-center {
        width: 56%;
    }
    .world-map {
        height: 320px;
    }
}

@media (max-width: 1200px) {
    .dashboard {
        flex-direction: column; /* Stack panels on smaller screens */
        height: auto; /* Allow content to define height */
        max-height: 95vh; /* Still constrain overall height */
        transform-style: flat; /* Disable 3D for stacked layout */
        perspective: none;
        overflow-y: auto; /* Allow dashboard itself to scroll if content overflows */
        padding: 10px;
    }
    .panel {
        width: 100% !important; /* Full width for stacked panels */
        transform: none !important; /* Reset 3D transforms */
        margin-bottom: 15px;
        height: auto; /* Let content define height */
        max-height: 70vh; /* Max height for individual panels when stacked */
    }
    .panel:last-child {
        margin-bottom: 0;
    }
    .panel-content {
        padding: 15px;
    }
    .dashboard-controls {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    .world-map {
        height: 300px; /* Fixed height might be better in stacked layout */
    }
    #radarChart.chart-container {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto; /* Allow body to scroll on very small screens if dashboard overflows */
    }
    .dashboard-container{
        width: 95%;
    }
    .panel-title {
        font-size: 16px;
    }
    .dashboard-title {
        font-size: 20px;
    }
    .two-column-form {
        grid-template-columns: 1fr; /* Single column form on small screens */
    }
    .stats-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    .stat-card .stat-value {
        font-size: 18px;
    }
    .control-value {
        font-size: 14px;
    }
    .world-map {
        height: 250px;
    }
}
/* --- 在 style.css 文件底部添加 --- */

/* 系统设置中可点击的P标签样式 (用于用户管理触发) */
.panel-left .card-content p#userManagementTrigger {
    cursor: pointer;
    transition: color 0.3s ease;
}
.panel-left .card-content p#userManagementTrigger:hover {
    color: var(--accent-color);
}
/* 如果P标签内的i也需要样式，可以像这样 */
.panel-left .card-content p#userManagementTrigger i {
     margin-right: 8px; /* 保持与之前一致 */
}

/* 用户管理模态框样式 */
.modal {
    display: none; /* 初始隐藏 */
    position: fixed; /* 固定位置，覆盖整个屏幕 */
    z-index: 1000; /* 确保在最上层 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* 如果内容过多则允许滚动 */
    background-color: rgba(0, 0, 0, 0.6); /* 半透明黑色背景 */
    backdrop-filter: blur(5px); /* 背景模糊效果 (现代浏览器) */
    animation: fadeInModalBackground 0.3s ease-out;
}

@keyframes fadeInModalBackground {
    from { background-color: rgba(0,0,0,0); backdrop-filter: blur(0px); }
    to { background-color: rgba(0,0,0,0.6); backdrop-filter: blur(5px); }
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto; /* 垂直居中，水平自动边距 */
    padding: 25px 30px;
    border: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.3);
    border-radius: 15px;
    width: 80%;
    max-width: 600px; /* 最大宽度 */
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: slideInModalContent 0.4s ease-out;
}

@keyframes slideInModalContent {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close-btn {
    color: var(--text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    transition: color 0.3s ease;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    color: var(--danger-color);
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    color: var(--accent-color);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 1px solid rgba(var(--secondary-color-rgb, 0, 204, 255), 0.2);
    padding-bottom: 10px;
}
.modal-content h2 i {
    margin-right: 10px;
}

#userListContainer {
    max-height: 400px; /* 限制列表高度，超出则滚动 */
    overflow-y: auto;
    padding-right: 10px; /* 为滚动条留出空间 */
}

/* 用户列表项样式 */
.user-list-item {
    background-color: rgba(var(--primary-color-rgb, 241, 67, 8), 0.05);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary-color);
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.user-list-item:last-child {
    margin-bottom: 0;
}
.user-list-item .user-identifier {
    color: var(--text-color);
}
.user-list-item .user-role {
    font-size: 13px;
    color: var(--accent-color);
    font-weight: bold;
    background-color: rgba(var(--accent-color-rgb, 0, 255, 204), 0.15);
    padding: 3px 8px;
    border-radius: 5px;
}

/* 错误消息样式 (复用 auth 的，如果 auth-container 里的 error-message-auth 样式通用) */
#userManagementError {
    /* 如果 .error-message-auth 的样式不能直接复用，在这里定义 */
    color: var(--danger-color);
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    margin-bottom: 15px;
}